package com.ai.chat.mapper;

import com.ai.chat.entity.Message;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface MessageMapper extends BaseMapper<Message> {
    /**
     * 根据对话ID查询消息列表
     * @param conversationId 对话ID
     * @return 消息列表
     */
    @Select("SELECT * FROM t_message WHERE conversation_id = #{conversationId} AND is_deleted = 0 ORDER BY create_time ASC")
    List<Message> selectByConversationId(Long conversationId);
}